package com.ruoyi.fun.domain;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import java.io.IOException;

/**
 * 购物车对象 ec_cart
 * 
 * @author ruoyi
 * @date 2025-08-06
 */
public class EcCart extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /**
     * 自定义Long类型反序列化器，处理大数值字符串
     */
    public static class LongDeserializer extends JsonDeserializer<Long> {
        @Override
        public Long deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
            String value = p.getValueAsString();
            if (value == null || value.trim().isEmpty()) {
                return null;
            }
            try {
                return Long.valueOf(value.trim());
            } catch (NumberFormatException e) {
                throw new IOException("Invalid Long value: " + value, e);
            }
        }
    }

    /** 购物车ID */
    @JsonDeserialize(using = LongDeserializer.class)
    private Long cartId;

    /** 用户ID */
    @Excel(name = "用户ID")
    private Long userId;

    /** 商品ID */
    @Excel(name = "商品ID")
    private Long productId;

    /** SKU ID */
    @Excel(name = "SKU ID")
    private Long skuId;

    /** 数量 */
    @Excel(name = "数量")
    private Long quantity;

    /** 是否选中 */
    @Excel(name = "是否选中")
    private String checked;

    /** 商品名称（关联查询） */
    private String productName;

    /** 商品价格（关联查询） */
    private java.math.BigDecimal productPrice;

    /** 商品图片（关联查询） */
    private String productImage;

    /** 分类名称（关联查询） */
    private String categoryName;

    /** SKU名称（关联查询） */
    private String skuName;

    /** 原价（关联查询） */
    private java.math.BigDecimal originalPrice;

    /** 库存（关联查询） */
    private Long stock;

    /** 用户名称（关联查询） */
    private String userName;

    
    /** 组织ID */
    @Excel(name = "组织ID")
    private Long orgId;

    public void setCartId(Long cartId) 
    {
        this.cartId = cartId;
    }

    public Long getCartId() 
    {
        return cartId;
    }

    public void setUserId(Long userId) 
    {
        this.userId = userId;
    }

    public Long getUserId() 
    {
        return userId;
    }

    public void setProductId(Long productId) 
    {
        this.productId = productId;
    }

    public Long getProductId() 
    {
        return productId;
    }

    public void setSkuId(Long skuId) 
    {
        this.skuId = skuId;
    }

    public Long getSkuId() 
    {
        return skuId;
    }

    public void setQuantity(Long quantity) 
    {
        this.quantity = quantity;
    }

    public Long getQuantity() 
    {
        return quantity;
    }

    public void setChecked(String checked) 
    {
        this.checked = checked;
    }

    public String getChecked() 
    {
        return checked;
    }

    public void setProductName(String productName) 
    {
        this.productName = productName;
    }

    public String getProductName() 
    {
        return productName;
    }

    public void setProductPrice(java.math.BigDecimal productPrice) 
    {
        this.productPrice = productPrice;
    }

    public java.math.BigDecimal getProductPrice() 
    {
        return productPrice;
    }

    public void setProductImage(String productImage) 
    {
        this.productImage = productImage;
    }

    public String getProductImage() 
    {
        return productImage;
    }

    public void setCategoryName(String categoryName) 
    {
        this.categoryName = categoryName;
    }

    public String getCategoryName() 
    {
        return categoryName;
    }

    public void setSkuName(String skuName) 
    {
        this.skuName = skuName;
    }

    public String getSkuName() 
    {
        return skuName;
    }

    public void setOriginalPrice(java.math.BigDecimal originalPrice) 
    {
        this.originalPrice = originalPrice;
    }

    public java.math.BigDecimal getOriginalPrice() 
    {
        return originalPrice;
    }

    public void setStock(Long stock) 
    {
        this.stock = stock;
    }

    public Long getStock() 
    {
        return stock;
    }

    public void setUserName(String userName) 
    {
        this.userName = userName;
    }

    public String getUserName() 
    {
        return userName;
    }

    public void setOrgId(Long orgId) 
    {
        this.orgId = orgId;
    }

    public Long getOrgId() 
    {
        return orgId;
    }
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("cartId", getCartId())
            .append("userId", getUserId())
            .append("productId", getProductId())
            .append("skuId", getSkuId())
            .append("quantity", getQuantity())
            .append("checked", getChecked())
            .append("productName", getProductName())
            .append("productPrice", getProductPrice())
            .append("productImage", getProductImage())
            .append("categoryName", getCategoryName())
            .append("skuName", getSkuName())
            .append("originalPrice", getOriginalPrice())
            .append("stock", getStock())
            .append("createTime", getCreateTime())
            .append("updateTime", getUpdateTime())
            .toString();
    }
}
